package com.svse.test;


import com.svse.enums.ColorEnum;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Copyright 上海危网信息科技有限公司版权所有
 * @company wwsoft
 * @Date 2019/12/4 13:17
 */
public class EnumTest01 {
    private  String color="";
    public static void main(String[] args) {
        ColorEnum colorEnum=ColorEnum.BLANK;
        change(colorEnum);
    }

    //switch case
    public static void change(ColorEnum colorEnum){
        switch (colorEnum){
            case RED:
                System.out.println("RED");
                break;
            case BLANK:
                System.out.println("BLANK");
                break;
            case GREEN:
                System.out.println("GREEN");
                break;
            default:
                System.out.println("五彩斑斓的黑");
                break;
        }

    }

    //循环输出枚举值
    public static void print(){
        for(ColorEnum color:ColorEnum.values()) {
            System.out.println(color+",ordinal:"+color.ordinal()+",name:"+color.name());
        }
    }
}
